<%--
  Created by IntelliJ IDEA.
  User: Jamin
  Date: 2019/1/21
  Time: 16:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <meta charset="UTF-8">
    <title>${忘记密码}</title>
    <link rel="stylesheet" href="../../css/bootstrap.css">
    <link rel="stylesheet" href="../../css/style.css">
    <script src="../../js/jquery.min.3.1.0.js"></script>
    <script src="../../css/bootstrap.css"></script>
    <script src="../../layuiadmin/layui/layui.all.js"></script>
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <header class="pay-header login">
        <a href="/${contextPath}" class="logo">
            <img src="../../images/logo2.png">
        </a>
    </header>
</head>
<body>

<main class="register">

    <form action="" method="post" id="form" class="layui-form">
        <table class="register-table">
            <tbody>
            <tr>
                <td colspan="2" class="register-tip" name="f_account">请输入账号</td>
            </tr>
            <tr>
                <td class="left-col">账号</td>
                <td class="right-col"><input name="f_account" id="f_account" lay-filter="account"
                                             lay-verify="account"></td>
            </tr>
            <tr>
                <td colspan="2" class="register-tip">请输入手机号</td>
            </tr>
            <tr>
                <td class="left-col">手机号</td>
                <td class="right-col"><input type="password" name="f_phonenumber" lay-filter="phonenumber"
                                             lay-verify="phonenumber"></td>
            </tr>
            <tr>
                <td colspan="2" class="register-tip">请输入密码</td>
            </tr>
            <tr>
                <td class="left-col">密码</td>
                <td class="right-col"><input type="password" name="password" id="password" lay-filter="password"
                                             lay-verify="password"></td>
            </tr>
            <tr>
                <td colspan="2" class="register-tip">请再次输入密码</td>
            </tr>
            <tr>
                <td class="left-col">密码确认</td>
                <td class="right-col"><input type="password" placeholder="请再次输入你的密码" name="repeatpassword"
                                             id="repeatpassword" lay-verify="repeatpassword"></td>
            </tr>

            <tr>

                <td colspan="2" class="button-td">
                    <input type="hidden" name="refer" id="refer">
                    <button lay-submit="" lay-filter="forgetPassword">提 交</button>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</main>
<footer class="footer-bottom">


    <div class="foot-content login">
        <div class="copyright" id="copyright">
            <div class="white-link login-text">
                <a>关于天猫</a>
                <a>帮助中心</a>
                <a>开放平台</a>
                <a> 诚聘英才</a>
                <a>联系我们</a>
                <a>网站合作</a>
                <a>法律声明</a>
                <a>知识产权</a>
                <a>廉正举报 </a>
            </div>
            <div class="white-link login-text">
                <a> 阿里巴巴集团</a><span class="slash">|</span>
                <a> 淘宝网</a><span class="slash">|</span>
                <a>天猫 </a><span class="slash">|</span>
                <a> 聚划算</a><span class="slash">|</span>
                <a>全球速卖通</a><span class="slash">|</span>
                <a>阿里巴巴国际交易市场</a><span class="slash">|</span>
                <a>1688</a><span class="slash">|</span>
                <a>阿里妈妈</a><span class="slash">|</span>
                <a> 阿里旅行·去啊 </a><span class="slash">|</span>
                <a> 阿里云计算 </a><span class="slash">|</span>
                <a> 友盟 </a><span class="slash">|</span>
                <a> 虾米 </a><span class="slash">|</span>
                <a> 天天动听 </a><span class="slash">|</span>
                <a> 来往 </a><span class="slash">|</span>
                <a> 钉钉 </a><span class="slash">|</span>
                <a> 支付宝 </a>
            </div>
            <div class="license">
                <span>增值电信业务经营许可证： <a>浙B2-20110446</a></span>
                <span>网络文化经营许可证：<a>浙网文[2015]0295-065号</a></span>
                <span><a>12318举报 </a></span><br>
                <span>互联网药品信息服务资质证书编号：<a>浙-（经营性）-2012-0005</a></span>
                <div class="copy-right-year">© 2003-2017 TMALL.COM 版权所有</div>

            </div>
        </div>
    </div>
</footer>


</body>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit


        //自定义验证规则
        form.verify({


            account: function (value) {
                if (value.length == 0) {
                    return '账号不得为空';
                }
            }
            , password: [
                /^[\S]{6,12}$/
                , '密码必须6到12位，且不能出现空格'
            ]
            , phonenumber: [
                /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/
                , '请输入正确的手机号'
            ]
            , repeatpassword: function (value) {
                if (value.length == 0) {
                    return '请确认密码'
                }
            }

        });


        //监听提交
        //监听提交
        form.on('submit(forgetPassword)', function (data) {

            if ($("#repeatpassword").val() != $("#password").val()) {
                alert("两次输入的密码不一致");
                return false;
            }else {


            $.ajax({
                type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "/ForgetPasswordServelt",//url
                data: $('#form').serialize(),
                success: function (data) {
                    if (data.fp) {
                        alert("重置密码成功");
                        window.location.href = "Login.jsp";
                    } else {
                        alert("账号或手机号错误");
                        window.location.href = "ForgetPassword.jsp";
                    }


                }
            });


            return false;
        }});


        return false;
    });


</script>
</html>
